#include "cpu/exec/helper.h"

make_helper(push_r_v) {
    uint8_t reg_index = ops_decoded.opcode & 0x7;
    cpu.esp -= 4;
    swaddr_write(cpu.esp, 4, reg_l(reg_index));

    print_asm("push %%%s", regsl[reg_index]);
    return 1;
}

make_helper(push_rm_v) {
    decode_rm_l(eip + 1);

    cpu.esp -= 4;
    swaddr_write(cpu.esp, 4, op_src->val);

    print_asm("push %s", op_src->str);
    return 2;
}

make_helper(push_i_v) {
    uint32_t imm32 = instr_fetch(eip + 1, 4);
    cpu.esp -= 4;
    swaddr_write(cpu.esp, 4, imm32);

    print_asm("push $0x%x", imm32);
    return 5;
}